/*
 * Main.java
 *
 * Created on 02/07/2007, 09:08:12
 *
 */
package br.com.grillo.jturbonote;

import java.io.IOException;
import java.net.InetAddress;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;

/**
 *
 * @author grillo
 */
public class Main {

    public static DateFormat DATA_DEFAULT = new SimpleDateFormat("dd/MM/yyyy");
    public static Logger logger = Logger.getLogger("jTurboNote");

    /** Creates a new instance of Main */
    private Main() {
    }

    public static String getDataFormatada(Long time) {
        return DATA_DEFAULT.format(new Date(time));
    }

    public static String getHostFormatado(InetAddress address) {
        String saida = "";
        if (address != null) {
            saida = address.getHostName();
            if (saida.contains(".local")) { // GATO
                saida = saida.substring(0, saida.indexOf("."));
            }
        }
        return saida;
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception ex) {
            logger.log(Level.WARNING, "Erro ao setar lookandfeel", ex);
        }
        MenuSistema.getInstance().init();

        ServidorJTurboNote servidor = new ServidorJTurboNote();
        try {
            servidor.init();
        } catch (IOException ioEx) {
            logger.log(Level.SEVERE, "Erro no init", ioEx);
        }
    }
}
